import {isMobileTerminal} from "../utils/flexible";

export default {
    //简单访问
    categories: (state) => state.category.categories,
    //当前主题
    themeType: (state) => state.theme.themeType,
    //category 选中项
    currentCategory: (state) => state.app.currentCategory,
    //选中项的下标
    currentCategoryIndex: (state, getters) => {
        return getters.categories.findIndex((item) => {
            return item.id === getters.currentCategory.id
        })
    },
    //搜索历史
    histories: (state) => state.search.histories,
    //token
    token: (state) => state.user.token,
    //用户信息
    userInfo: (state) => state.user.userInfo,
    //路由跳转方式
    routerType: (state) => {
        // 在 PC 端下，永远为 none
        if (!isMobileTerminal.value) {
            return 'none'
        }
        return state.app.routerType
    }
}